<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //相当于是 useEffect 的第一个参数(回调函数)
    let callback = function(){
      div.style.left = '500px';
    }
    //dom 操作
    //模拟渲染流程
    let div = document.createElement('div');
    div.style.width = '200px';
    div.style.height = '100px';
    div.style.position = 'absolute';
    div.style.left = '0px';
    div.style.background = '#c90';
    //插入到 body 标签中
    document.body.append(div);

    //useEffect 的情形, 异步执行回调
    // setTimeout(() => {
    //   callback();
    // }, 10);

    //useLayoutEffect 的情形, 同步执行回调
    callback();


    


  </script>
</body>
</html>